<div class="demo-content">
    <?php $form=$this->beginWidget('CActiveForm', array(
        'id'=>'model-_form-form',
        'enableAjaxValidation'=>false,
        'enableClientValidation'=>false,
        'clientOptions'=>array(  
            'validateOnSubmit'=>false,  
         ),
         'htmlOptions'=>array('class'=>'form-horizontal')
      )); ?>
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['position_name'] ?><span class="required">*</span>：</label>
        <div class="controls">
          <?php echo $form->textField($this->oModel,'position_name' ,array('data-rules'=>"{required:true}",'data-messages'=>"{required:'推荐信名称不能为空'}",'class'=>'input-large')); ?>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['model_id'] ?><span class="required">*</span>：</label>
        <div class="controls">
          <?php echo $form->dropDownList($this->oModel,'model_id' ,CmsModel::getAllModelList() ,array('url'=>$this->createUrl('position/ajaxChangeModel') ,'class'=>'input-normal OnChagnModel')); ?>
        </div>
      </div>  
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['cate_id'] ?><span class="required">*</span>：</label>
        <div class="controls modelcategory">
          <?php //echo $form->textField($this->oModel,'cate_id' ,array('class'=>'input-normal')); ?>
          <select name="AdminCategory[cate_id]" class="input-normal">
            <option value="0">顶级栏目</option>
            <?php
            $fid = isset($this->oModel->cate_id) ? (int)$this->oModel->cate_id : 0;
            $menuData = AdminCategory::getCategoryData();
            $tree = new Tree($menuData);
            $tree->icon = array('&nbsp;│ ','&nbsp;├─ ','&nbsp;└─ ');
            $tree->nbsp = '&nbsp;';
            $str="<option value='\$id' \$selected>\$spacer\$cate_name</option>";
            $categorys = $tree->get_tree(0, $str, $fid);
            echo $categorys;
            ?>
            </select> 
        </div>
      </div>
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['max_number'] ?><span class="required">*</span>：</label>
        <div class="controls">
          <?php echo $form->textField($this->oModel,'max_number' ,array('class'=>'width80')); ?>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['sort'] ?><span class="required">*</span>：</label>
        <div class="controls">
          <?php echo $form->textField($this->oModel,'sort' ,array('class'=>'width80')); ?>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label"><?php echo $this->_attributeLabels['disable'] ?><span class="required">*</span>：</label>
        <div class="controls">
          <?php //echo $form->textField($this->oModel,'disable' ,array('class'=>'width80')); ?>
          <?php
                echo $form->radioButtonList($this->oModel ,'disable' ,Yii::app()->dict->get('module' ,'disable') ,array('separator'=>'&nbsp;'));
          ?>
        </div>
      </div>
      <?php $this->endWidget(); ?>
<!-- script end -->
</div>
<script type="text/javascript">
$('.OnChagnModel').bind('change' ,function(){
    var jqThis = $(this) ,val = jqThis.val() ,url = jqThis.attr('url') + '?model_id='+val;
    $.getJSON(url ,function(jData){
        if( jData.err==0 ){
            $('.modelcategory').html(jData.data);
        }
    });
});
</script>